#ifndef WRAP_QLINE_H
#define WRAP_QLINE_H

#include <QObject>
#include <QLine>
#include "qluascriptable.h"
#include "qluascriptengine.h"
#include "qluascriptvalue.h"
#include "qluascriptclass.h"
#include "qluaglobal.h"

class QLine_Prototype : public QObject, public QLuaScriptable
{
    Q_OBJECT
    Q_INTERFACES(QLuaScriptable)
    Q_PROPERTY(QPoint p1 READ p1 WRITE setP1)
    Q_PROPERTY(QPoint p2 READ p2 WRITE setP2)
    Q_PROPERTY(int x1 READ x1)
    Q_PROPERTY(int y1 READ y1)
    Q_PROPERTY(int x2 READ x2)
    Q_PROPERTY(int y2 READ y2)
    Q_PROPERTY(int dx READ dx)
    Q_PROPERTY(int dy READ dy)
public:
    QLine_Prototype(QObject * parent = 0);

    inline QPoint p1() const { return ptr()->p1(); }
    inline QPoint p2() const { return ptr()->p2(); }

    inline int x1() const { return ptr()->x1(); }
    inline int y1() const { return ptr()->y1(); }
    inline int x2() const { return ptr()->x2(); }
    inline int y2() const { return ptr()->y2(); }
    inline int dx() const { return ptr()->dx(); }
    inline int dy() const { return ptr()->dy(); }

    inline void setP1(const QPoint &p1) { ptr()->setP1(p1); }
    inline void setP2(const QPoint &p2) { ptr()->setP2(p2); }

public slots:
    inline bool isNull() const {
        return ptr()->isNull();
    }

    inline void translate(const QPoint &p) {
        ptr()->translate(p);
    }

    inline void translate(int dx, int dy) {
        ptr()->translate(dx, dy);
    }

    inline QLine translated(const QPoint &p) const {
        return ptr()->translated(p);
    }

    inline QLine translated(int dx, int dy) const {
        return ptr()->translated(dx, dy);
    }

    inline void setPoints(const QPoint &p1, const QPoint &p2) {
        ptr()->setPoints(p1, p2);
    }

    inline void setLine(int x1, int y1, int x2, int y2) {
        ptr()->setLine(x1, y1, x2, y2);
    }

private:
    QLine * ptr() const;
};

class QLineF_Prototype : public QObject, public QLuaScriptable
{
    Q_OBJECT
    Q_INTERFACES(QLuaScriptable)
    Q_PROPERTY(QPointF p1 READ p1 WRITE setP1)
    Q_PROPERTY(QPointF p2 READ p2 WRITE setP2)
    Q_PROPERTY(qreal x1 READ x1)
    Q_PROPERTY(qreal y1 READ y1)
    Q_PROPERTY(qreal x2 READ x2)
    Q_PROPERTY(qreal y2 READ y2)
    Q_PROPERTY(qreal dx READ dx)
    Q_PROPERTY(qreal dy READ dy)
public:
    QLineF_Prototype(QObject * parent = 0);

    inline QPointF p1() const { return ptr()->p1(); }
    inline QPointF p2() const { return ptr()->p2(); }

    inline qreal x1() const { return ptr()->x1(); }
    inline qreal y1() const { return ptr()->y1(); }
    inline qreal x2() const { return ptr()->x2(); }
    inline qreal y2() const { return ptr()->y2(); }
    inline qreal dx() const { return ptr()->dx(); }
    inline qreal dy() const { return ptr()->dy(); }

    inline void setP1(const QPointF &p1) { ptr()->setP1(p1); }
    inline void setP2(const QPointF &p2) { ptr()->setP2(p2); }

public slots:
    inline bool isNull() const {
        return ptr()->isNull();
    }

    inline void translate(const QPointF &p) {
        ptr()->translate(p);
    }

    inline void translate(qreal dx, qreal dy) {
        ptr()->translate(dx, dy);
    }

    inline QLineF translated(const QPointF &p) const {
        return ptr()->translated(p);
    }

    inline QLineF translated(qreal dx, qreal dy) const {
        return ptr()->translated(dx, dy);
    }

    inline void setPoints(const QPointF &p1, const QPointF &p2) {
        ptr()->setPoints(p1, p2);
    }

    inline void setLine(qreal x1, qreal y1, qreal x2, qreal y2) {
        ptr()->setLine(x1, y1, x2, y2);
    }
private:
    QLineF * ptr() const;
};

class QLine_wrapper : public QObject, public QLuaScriptClass
{
    Q_OBJECT
    Q_INTERFACES(QLuaScriptClass)
public:
    QLine_wrapper(QLuaScriptEngine * engine);

    virtual QueryFlags queryProperty(const QLuaScriptValue& object,
                                     const QByteArray& name);
    virtual QLuaScriptValue property(const QLuaScriptValue& object,
                                          const QByteArray& name);
    virtual QLuaScriptValue prototype() const;
    virtual QString name() const;

private:
    static QLuaScriptValue QLine_toScriptValue(QLuaScriptEngine * engine, const QLine * t);
    static void QLine_fromScriptValue(const QLuaScriptValue& value, QLine * t);
    static QLuaScriptValue new_line(QLuaScriptContext *, QLuaScriptEngine *);

private:
    QLuaScriptValue m_proto;
};

class QLineF_wrapper : public QObject, public QLuaScriptClass
{
    Q_OBJECT
    Q_INTERFACES(QLuaScriptClass)
public:
    QLineF_wrapper(QLuaScriptEngine * engine);

    virtual QueryFlags queryProperty(const QLuaScriptValue& object,
                                     const QByteArray& name);
    virtual QLuaScriptValue property(const QLuaScriptValue& object,
                                          const QByteArray& name);
    virtual QLuaScriptValue prototype() const;
    virtual QString name() const;

private:
    static QLuaScriptValue QLineF_toScriptValue(QLuaScriptEngine * engine, const QLineF * t);
    static void QLineF_fromScriptValue(const QLuaScriptValue& value, QLineF * t);
    static QLuaScriptValue new_lineF(QLuaScriptContext *, QLuaScriptEngine *);

private:
    QLuaScriptValue m_proto;
};


#endif // WRAP_QLINE_H
